package cn.karent.core;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import lombok.*;

import java.time.Duration;
import java.util.Map;

/**
 * @author wanshengdao
 * @date 2025/3/20
 */
@Setter
@Getter
@Builder
@NoArgsConstructor
@AllArgsConstructor
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class ConfigCmd {

    @NotBlank(message = "topic不能为空")
    private String topic;

    @NotBlank(message = "消费者组不能为空")
    private String group;

    @Valid
    private ProcessorConfig processor;

    /**
     * 监听多少时间
     */
    private Duration duration;

    @Getter
    @Setter
    public static class ProcessorConfig {

        @NotBlank(message = "处理器名字不能为空")
        private String name;

        private Map<String, Object> config;

    }

}
